<!DOCTYPE html>
<html>

<head>

    {include file="Public/header"}
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
</head>

<body style="color:#333;padding:3px;" class="x_sorll">
<!-- 标题 -->
<div class="page-heade clearfix">
    <h2 class="clearfix text-center"><a class="col-md-6 title_color H_right  H_active" id="Ap1" style="font-size: 16px;">我的销售订单</a>
        <a class="col-md-6 title_color" id="Ap2" style=" font-size: 16px;color:#333;" href="{:url('wdxsddmxcx')}">我的销售订单明细查询</a>
    </h2>
</div>
<!-- 标题 -->
<div>
    <form action="" class="form-inline">
        <table class="row-margin-top tab-content table-bordered table text-left" border="1">
            <tr>
                <td colspan="6"><a href="{:url('add')}" class="btn-info btn btn-sm">添加销售订单</a></td>
            </tr>
            <tr>
                <td style="min-width: 160px" class="text-right"><label for="" class="form-label">分区：</label></td>
                <td><input type="text" class="form-control" name="zoning" value="{$zoning}"></td>
                <td style="min-width: 160px" class="text-right"><label for="" class="form-label">省份：</label></td>
                <td><input type="text" class="form-control" name="provice" value="{$provice}"></td>
                <td style="min-width: 160px" class="text-right"><label for="" class="form-label">城市：</label>
                </td>
                <td><input type="text" class="form-control" name="city" value="{$city}"></td>
            </tr>
            <tr>
                <td style="min-width: 160px" class="text-right"><label for="" class="form-label">订单号：</label></td>
                <td><input type="text" class="form-control" name="ordersn" value="{$ordersn}"></td>
                <td style="min-width: 160px" class="text-right"><label for="" class="form-label">经销商编号：</label></td>
                <td><input type="text" class="form-control" name="jxssn" value="{$jxssn}"></td>
                <td style="min-width: 160px" class="text-right"><label for="" class="form-label">经销商名称：</label>
                </td>
                <td><input type="text" class="form-control" name="jxsname" value="{$jxsname}"></td>
            </tr>
            <tr>
                <td style="min-width: 160px" class="text-right"><label for="" class="form-label">时间段：</label>
                </td>
                <td>
                    <div class="form-group">
                        <input type="text" id="start" class="form-control layer-date "
                               style="min-width: 100px;width: 100px; display: inline-block;" name="start"
                               value="{$start}">
                    </div>
                    <div class="form-group">
                        到
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control layer-date"
                               style="min-width: 100px;width: 100px;display: inline-block;" id="end"
                               name="end" value="{$end}">
                    </div>
                </td>
                <td style="min-width: 160px" class="text-right"><label for="" class="form-label">金额(元)范围：</label>
                </td>
                <td>
                    从<input type="text" class="form-control" style="min-width: 80px;width: 80px" name="minNum"
                            value="{$minNum}">
                    到<input type="text" class="form-control" style="min-width: 80px;width: 80px" name="maxNum"
                            value="{$maxNum}">
                </td>
                <td style="min-width: 160px" class="text-right"><label for="" class="form-label">申请状态：</label>
                </td>
                <td>
                    <select name="applyStatus" id="applyStatus" class="form-control select">
                        <option value="">请选择</option>
                        <option value="1" {if $applyStatus==1}selected{/if}>已批准</option>
                        <option value="2" {if $applyStatus==2}selected{/if}>未批准</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="6" class="text-center">
                    <button class="btn btn-info btn-sm query" type="submit">查询</button>
                    <button class="btn btn-info btn-sm emptyIf" type="button">清空</button>
                    <button class="btn btn-info btn-sm LendExcel" type="button">导出Excel</button>
                </td>
            </tr>
        </table>

        <table class="table table-striped row-margin-top table-bordered text-center bud_hei">
            <tr class="info text-center">
                <th class="text-center">NO.</th>
                <th class="text-center">分区</th>
                <th class="text-center">省份</th>
                <th class="text-center">城市</th>
                <th class="text-center">时间</th>
                <th class="text-center">订单号</th>
                <th class="text-center">申请人</th>
                <th class="text-center">经销商编号</th>
                <th class="text-center">经销商名称</th>
                <th class="text-center">渠道优惠政策编号</th>
                <th class="text-center">发票类型</th>
                <th class="text-center">申请状态</th>
                <th class="text-center">箱数</th>
                <th class="text-center">金额(元)</th>
                <th class="text-center">操作</th>
            </tr>
            {volist name="data" id="row" key="k"}
            <tr>
                <td>{$k+((request()->get('page')?request()->get('page'):1)-1)*10}</td>
                <td>{$row.zoning}</td>
                <td>{$row.provice}</td>
                <td>{$row.city}</td>
                <td>{$row.jyfhrq}</td>
                <td><a href="{:url('view',['id'=>$row.id])}" class="J_menuItem">{$row.sn}</a></td>
                <td>{$row.sqr}</td>
                <td>{$row.jxssn}</td>
                <td>{$row.jxsname}</td>
                <td>{$row.yhPolicy}</td>
                <td>{$row.fpType}</td>
                <td>{$row.statustype}</td>
                <td></td>
                <td>{$row.yszje}</td>
                <td>
                    {if $row.status==1}
                    <a href="{:url('tjgzl',['id'=>$row.id])}" class="tjgzl">提交工作流</a>
                    <a href="{:url('update',['id'=>$row.id])}" >修改</a>
                    <a data-link="{:url('delete',['id'=>$row.id])}" class="shanchu">删除</a>
                    {elseif $row.status==2}
                        <a href="{:url('update',['id'=>$row.id])}" >作废/修改</a>
                         <a href="{:url('cklct',['id'=>$row.id])}" class="J_menuItem">查看流程图</a>
                    {else}
                    <a href="{:url('cklct',['id'=>$row.id])}" class="J_menuItem">查看流程图</a>
                    {/if}
                </td>
            </tr>
            {/volist}
        </table>
    </form>
     <div class="row text-center" id="pageText" style="padding: 0;margin: 0;">
			<div class="col-sm-6 text-left"><div class="padding-10 countSize">共{$count}条记录，{$maxpage}页&nbsp;&nbsp;</div></div>
			<div class="col-sm-6 text-right">{$page}</div>
		</div>
</div>
<!-- 全局js -->
{include file="Public/footer"}
<!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
<script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
<script src="__STATIC__/layout/js/contabs_sub.js"></script>
<script>
    //提交工作流
    $('.tjgzl').click(function () {
        var link = $(this).prop('href')
        swal({
            title: "您确定提交工作流吗",
            text: "",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            closeOnConfirm: false
        }, function (isConfirm) {
            if(isConfirm){
                $.ajax({
                    'type':'post',
                    'url':link,
                    'dataType':'json',
                    'success':function (data) {
                        if(data.success){
                            swal({
                                title:data.msg,
                                type:'success'
                            },function () {
                                location.reload()
                            })
                        }else
                            swal(data.msg, "", "error");
                    }
                })
            }

        });
        return false
    });
    $('.shanchu').on('click',function () {
        var link = $(this).data('link')
        swal({
            title:"确定删除吗？",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            closeOnConfirm: false},function (is) {
            if(is){
                $.getJSON(link,function (data) {
                    swal({title:data.msg,type:'success'},function () {
                        location.reload()
                    })
                })
            }
        })

    })

    //日期范围限制
    var start = {
        elem: '#start',
        format: 'YYYY/MM/DD',
        min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY/MM/DD',
        min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
    $(function () {
        $('.emptyIf').on('click', function () {
            var form = $(this).closest('form')
            form.find('input[type=text]').each(function (i, o) {
                $(o).val('')
            })
            form.submit()
        })
        $('.LendExcel').on('click',function () {
            window.open('{:url("excel1")}')
        })
    })
</script>
</body>

</html>
